#include<bits/stdc++.h>

using namespace std;
//1m = 60s 1s = 1000ms
int main()
{
    int h,m,s;
    long long n;
    cin>>n;
    n = n / 1000 % (60 * 60 *24);
    h = n / (60 * 60);
    n = n %(60 * 60);
    m = n / 60;
    n = n % 60;
    s = n;
    cout<< h <<' '<<m<<' '<<s<<endl;
    return 0;
}
